using System.Collections;
using GameKit.Core;
using NUnit.Framework;
using UnityEngine;
using UnityEngine.TestTools;
using Logger = GameKitUnity.Logger;

namespace GameKitUnityTest
{
    public class TimerBehaviour : MonoBehaviour
    {
        public Timer timer;

        private void Update()
        {
            timer.OnUpdate(Time.deltaTime);
        }
    }

    public class Test_Timer
    {
        [SetUp]
        private void Init()
        {
            Log.SetLogger(new Logger());
        }

        [UnityTest]
        public IEnumerator TestTimer()
        {
            var timer = Timer.Start(5.0f, timer => { Assert.Pass("Timer completed"); });
            // Engine Runtime
            var go = new GameObject("TimerTest");
            var timerBehaviour = go.AddComponent<TimerBehaviour>();
            timerBehaviour.timer = timer;
            yield return new WaitForSeconds(10);
        }
    }
}